package com.dk.controller;

import com.dk.pojo.TabSeller;
import com.dk.service.SellerService;
import com.sun.org.apache.regexp.internal.RE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("seller")
public class SellerController {
    @Autowired
    SellerService sellerService;

    @RequestMapping("toshow")
    public String toshow() {
        return "seller/listClient";
    }

    @RequestMapping("listClient")
    @ResponseBody
    public List<TabSeller> selectInfo() {
        List<TabSeller> list = sellerService.selectInfo();
        return list;
    }

    @RequestMapping("insertInto")
    public String insertInto() {
        return "seller/add";
    }

    @RequestMapping("insertADD")
    @ResponseBody
    public boolean insertADD(TabSeller t) {
        boolean a = sellerService.insertADD(t);
        return a;
    }

    @RequestMapping("huixuan")

    public String huixuan(Integer sid, Model mo) {
        TabSeller a = sellerService.selectBsid(sid);
        mo.addAttribute("s", a);
        return "seller/update";
    }

    @RequestMapping("updateBid")
    @ResponseBody
    public boolean updateBid(TabSeller tabSeller) {
        boolean a = sellerService.updateInfo(tabSeller);
        return a;
    }

    @RequestMapping("empdelete")
    @ResponseBody
    public boolean mpdelete(Integer id) {
        boolean a = sellerService.deleteById(id);
        return a;
    }
}
